$tooltip-background-color: var(--pf-global--BackgroundColor--dark-100);

.co-alert-manager-config__edit-alert-routing-btn {
  margin-bottom: 10px;
}

.co-alert-manager-config__save-as-default-label {
  padding-left: 4px;
  padding-right: 4px;
}

.co-resource-item.co-resource-item--monitoring-alert {
  margin: 0 5px;
}

.co-routing-label-editor__error-message {
  margin-top: -15px;
}

.graph-empty-state {
  min-height: 310px;
  &__loaded {
    align-items: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

.graph-wrapper__horizontal-bar {
  padding-right: 10px;
}

.graph-wrapper.graph-wrapper--query-browser {
  padding: 5px 15px 15px 60px;

  &--with-legend {
    min-height: 305px;
  }
}

.monitoring-dashboards__card {
  height: calc(100% - 20px);
  margin: 0 0 20px 0;

  .co-dashboard-card__body--dashboard {
    // Add extra padding to the right. X-axis times with AM/PM at certain screen widths can overflow the card otherwise.
    padding: 10px 15px 10px 10px;
  }

  &.co-dashboard-card--gradient {
    .pf-c-card__body {
      max-height: 350px;
      overflow: scroll;
    }
    &:after {
      width: calc(100% - 10px);
    }
  }

  .query-browser__wrapper {
    border: 0;
    margin: 0;
    min-height: 240px;
    padding: 0;
  }
}

.monitoring-dashboards__card-body-content {
  height: 100%;
}

.monitoring-dashboards__card-header {
  flex: 0 0 auto;
}

.monitoring-dashboards__dropdown-button {
  max-width: 280px !important; // allow truncation
  min-width: 100px;
  @media (min-width: $screen-sm-min) {
    max-width: 100% !important;
  }
}

.monitoring-dashboards__dropdown-title {
  text-transform: capitalize;
}

.monitoring-dashboards__dropdown-wrap {
  display: flex;
  flex-direction: column;
  margin-right: 20px;

  .monitoring-dashboards__dashboard_dropdown_item {
    display: flex;
    justify-content: space-between;
  }
  .monitoring-dashboards__dashboard_dropdown_tag {
    font-weight: var(--pf-global--FontWeight--bold);
    line-height: 13px;
    margin-left: 20px;
  }
}

.monitoring-dashboards__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.monitoring-dashboards__label-column-header {
  // Set a min-width to avoid aggressive wrapping, which makes the table much taller.
  min-width: 175px;
  @media (min-width: $screen-lg-min) {
    min-width: 225px;
  }
}

.monitoring-dashboards__legend-wrap {
  $legend-content-height: 65px;
  height: $legend-content-height + 10px; // Add space for the horizontal scrollbar
  overflow-x: auto;
  padding-right: var(--pf-global--spacer--lg);
  padding-top: 1px;
  svg {
    max-height: $legend-content-height; // Required for Chrome to prevent vertical scrolling
  }
  &:after {
    background: linear-gradient(
      to left,
      var(--pf-global--BackgroundColor--100),
      rgba(255, 255, 255, 0)
    );
    content: '';
    height: $legend-content-height;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    width: var(--pf-global--spacer--lg);
  }
}

.monitoring-dashboards__options {
  display: flex;
  float: right;
  margin-right: -20px;
  margin-top: -20px;
}

.monitoring-dashboards__panel {
  padding: 0 10px;
}

.monitoring-dashboards__panel--max-1 {
  width: 100%;
}

$screen-phone-landscape-min-width: 567px;

@media (max-width: $screen-phone-landscape-min-width) {
  .monitoring-dashboards__panel--max-2,
  .monitoring-dashboards__panel--max-3,
  .monitoring-dashboards__panel--max-4 {
    min-width: 100%;
  }
}

@media (min-width: $screen-phone-landscape-min-width) and (max-width: $screen-md-max) {
  .monitoring-dashboards__panel--max-2 {
    width: 100%;
  }
  .monitoring-dashboards__panel--max-3,
  .monitoring-dashboards__panel--max-4 {
    flex: 1 0 50%;
    min-width: 50%;
  }
}

@media (min-width: $screen-lg-min) {
  .monitoring-dashboards__panel--max-2 {
    flex: 1 0 50%;
    min-width: 50%;
  }
  .monitoring-dashboards__panel--max-3 {
    flex: 1 0 33%;
    min-width: 33%;
  }
  .monitoring-dashboards__panel--max-4 {
    flex: 0 0 25%;
    min-width: 25%;
  }
}

.monitoring-dashboards__row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -10px;
}

.monitoring-dashboards__single-stat {
  font-size: var(--pf-global--FontSize--3xl);
}

.monitoring-dashboards__table {
  table-layout: auto;
  width: auto;
}

.monitoring-dashboards__table-container {
  overflow-x: auto;
}

.monitoring-dashboards__variable-dropdown {
  .pf-c-dropdown__menu, .pf-c-select__menu {
    max-height: 60vh;
    overflow-y: auto;
  }
  .pf-m-search {
    min-width: 140px;
  }
}

.monitoring-dashboards__variables {
  display: flex;
  flex-wrap: wrap;
}

$monitoring-line-height: 18px;

.monitoring-description,
.monitoring-label-list,
.monitoring-timestamp {
  line-height: $monitoring-line-height;
  margin-top: 4px;
}

.monitoring-description {
  // Limit to $num-lines lines of text. Truncate with an ellipsis in WebKit. Just overflow hidden for other browsers.
  $num-lines: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $num-lines;
  height: $num-lines * $monitoring-line-height;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitoring-grid-head {
  padding-bottom: 5px;
}

.monitoring-header-link {
  font-size: $font-size-base;
  margin-left: 14px;
}

.monitoring-heading {
  display: flex;
  justify-content: space-between;
}

.monitoring-icon-wrap {
  margin-right: 10px;
}

.monitoring-query {
  color: $color-pf-blue-400;
}

.monitoring-silence-alert {
  max-width: 950px;

  &__label-options {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
    @media (min-width: $grid-float-breakpoint) {
      padding-top: 26px;
    }
  }
}

.monitoring-state-icon--pending {
  color: $color-pf-black-700;
}

.monitoring-timestamp {
  display: flex;
  flex-flow: row wrap;
  font-size: ($font-size-base - 1);
}

.prometheus-template-tag {
  margin: 0 2px;
}

.query-browser__autocomplete-match {
  font-weight: var(--pf-global--FontWeight--bold);
}

.query-browser__clear-icon {
  font-size: 18px !important;
  padding: 4px !important;
  position: absolute !important;
  right: 0;
  top: 0;
  width: 30px;
}

.query-browser__controls {
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: space-between;
  margin-bottom: 15px;
  width: 100%;

  .pf-c-check__input {
    margin-top: 0;
  }
}

.query-browser__controls--left {
  display: flex;
}

.query-browser__controls--right {
  display: flex;
  margin-left: auto;
}

.query-browser__dropdown--subtitle {
  padding: 1px 10px;
}

.query-browser__expand-button {
  border: none;
  height: 30px;
  padding: 0 14px !important; // align with series buttons
}

.query-browser__expand-icon {
  font-size: 30px;
  vertical-align: middle;
}

.query-browser__inline-control {
  margin-left: 10px;
  margin-right: 10px;
}

.query-browser__loading {
  margin: auto 0;
  min-width: 20px;
}

.query-browser__metrics-dropdown-menu {
  max-height: 25vh;
  overflow: auto;
  width: 100%;

  &--insert {
    @media (min-width: $screen-sm-min) {
      max-width: 55vw;
    }
    max-width: 85vw;
    width: 550px;
  }
}

.query-browser__query {
  line-height: 1;
  margin: 0 15px 0 0;
  width: 100%;
}

.query-browser__query-controls {
  align-items: center;
  border: solid $color-grey-background-border;
  border-width: 1px 0;
  display: flex;
  padding: 10px 0;
}

.query-browser__query-input {
  padding-right: 28px !important;
  resize: vertical;
}

.query-browser__series-btn {
  border: 1px solid transparent;
  border-radius: var(--pf-global--BorderRadius--sm);
  height: 20px;
  padding: 0 !important;
  width: 20px;
  &--disabled {
    border: 1px solid #888 !important;
  }
}

.query-browser__series-btn-wrap {
  border: 1px solid transparent;
  border-radius: var(--pf-global--BorderRadius--sm);
  display: flex;
  height: 26px;
  padding: 2px;
  width: 26px;
  &:hover {
    background-color: var(--pf-global--active-color--200);
    border-color: var(--pf-global--active-color--100);
  }
}

.query-browser__span-dropdown-menu {
  right: 0;
  width: 130px;
}

.query-browser__span-text {
  max-width: 87px;
}

.query-browser__table {
  border-left: 3px solid transparent;
  margin-bottom: 25px;

  &--expanded {
    border-left-color: var(--pf-global--active-color--100);
  }

  tr > :first-child {
    width: 40px;
  }
}

.query-browser__table-cell {
  @include co-break-word;
  min-width: 120px;
  --pf-c-table-cell--PaddingRight: 0;
  --pf-c-table__sort-indicator--MarginLeft: 4px;
}

.query-browser__table-wrapper {
  overflow-x: auto;
  width: 100%;

  table {
    table-layout: auto;
  }
}

.query-browser__table-message {
  border-bottom: solid 1px $color-grey-background-border;
  padding: 10px 20px;
}

.query-browser__tech-preview {
  margin: 0 10px;
}

.query-browser__toggle-graph {
  margin-bottom: 5px;
  float: right;
}

.query-browser__tooltip {
  background-color: $tooltip-background-color;
  color: #eee;
  font-size: 12px;
  overflow-y: auto;
  padding: 10px;
}

.query-browser__tooltip-arrow {
  border-bottom: 12px solid transparent;
  border-right: 12px solid $tooltip-background-color;
  border-top: 12px solid transparent;
  height: 0;
  width: 0;
}

.query-browser__tooltip-group {
  align-items: stretch;
  display: flex;

  .query-browser__series-btn {
    flex: 0 0 12px;
    height: 12px;
    margin-top: 4px;
    margin-right: 3px;
  }
}

.query-browser__tooltip-line {
  stroke: $tooltip-background-color;
}

.query-browser__tooltip-time {
  font-weight: var(--pf-global--FontWeight--bold);
}

.query-browser__tooltip-value {
  font-weight: var(--pf-global--FontWeight--bold);
  margin-left: auto;
  padding-left: 10px;
  white-space: nowrap;
}

.query-browser__tooltip-wrap {
  align-items: center;
  display: flex;
  height: 100%;

  &--left {
    flex-direction: row-reverse;

    .query-browser__tooltip-arrow {
      border-left: 12px solid $tooltip-background-color;
      border-right: none;
    }
  }
}

.query-browser__wrapper {
  border: 1px solid $color-grey-background-border;
  margin: 0 0 20px 0;
  overflow: visible;
  padding: 10px;
  width: 100%;

  &--hidden {
    border-bottom: none;
    border-top: none;
    height: 0;
    margin: 0;
    padding-bottom: 0;
    padding-top: 0;
  }
}

.query-browser__zoom {
  cursor: ew-resize;
  position: relative;
  &:focus {
    outline: none;
  }
}

.query-browser__zoom-overlay {
  background-color: rgba(0, 0, 0, 0.2);
  bottom: 0;
  position: absolute;
  top: 0;
  z-index: $zindex-modal;
}
